/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.interpreter;

import java.util.Collection;
import java.util.List;

/**
 *
 * @author Laurent WOUTERS
 */
public interface Repository extends IRIProvider {
    xowl.lang.owl2.Ontology getOntology(String iri);
    xowl.lang.owl2.Ontology getOntology(xowl.lang.owl2.IRI iri);
    Collection<xowl.lang.owl2.Ontology> getOntologies();
    xowl.lang.owl2.Ontology resolveOntology(String iri);
    xowl.lang.owl2.Ontology resolveOntology(xowl.lang.owl2.IRI iri);
    void dropOntology(xowl.lang.owl2.Ontology ontology);
    
    xowl.lang.runtime.Value getLiteral(Object data);
    xowl.lang.runtime.Entity resolveEntity(String iri);
    xowl.lang.runtime.Entity resolveEntity(xowl.lang.owl2.IRI iri);
    xowl.lang.runtime.Class interpretAsClass(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.NamedIndividual interpretAsIndividual(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.ObjectProperty interpretAsObjectProperty(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.DataProperty interpretAsDataProperty(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.Datatype interpretAsDatatype(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.AnnotationProperty interpreterAsAnnotationProperty(xowl.lang.runtime.Entity entity);
    xowl.lang.runtime.Function interpretAsFunction(xowl.lang.runtime.Entity entity);
    
    Collection<xowl.lang.owl2.Axiom> getAxioms(xowl.lang.owl2.Ontology ontology);
    Collection<QuerySolution> select(xowl.lang.actions.Select query) throws XOWLException;
    
    void apply(Change change) throws XOWLException;
    void apply(Changeset changeset) throws XOWLException;
    void apply(RuleSet ruleset);
    void unapply(RuleSet ruleset);
    void apply(Transformation transformation);
    void unapply(Transformation transformation);
    Transformer createTransformer(Transformation transformation, boolean bindMeta);
    
    xowl.lang.owl2.Ontology loadOntology(String file, OWL2Syntax type);
    xowl.lang.owl2.Ontology loadOntology(String name, java.io.Reader reader, OWL2Syntax type);
    xowl.lang.owl2.Ontology loadOntology(String name, java.io.InputStream stream, OWL2Syntax type);
    boolean writeOntology(xowl.lang.owl2.Ontology ontology, String file, OWL2Syntax type);
    boolean writeOntology(xowl.lang.owl2.Ontology ontology, java.io.Writer writer, OWL2Syntax type);
    RuleSet loadRules(String file, OWL2Syntax type);
    RuleSet loadRules(String name, java.io.Reader reader, OWL2Syntax type);
    RuleSet loadRules(String name, java.io.InputStream stream, OWL2Syntax type);
    
    List<xowl.lang.actions.Select> loadQueries(String file, OWL2Syntax type);
    List<xowl.lang.actions.Select> loadQueries(String name, java.io.Reader reader, OWL2Syntax type);
    List<xowl.lang.actions.Select> loadQueries(String name, java.io.InputStream stream, OWL2Syntax type);
    
    void beginTransaction(String name);
    Transaction endTransaction();
    
    void addObserver(Observer observer);
    void removeObserver(Observer observer);
}
